/**
 * file
 */
package com.tdkj.action.front.member.risevalue;

import java.util.List;
import javax.annotation.Resource;
import com.opensymphony.xwork2.ActionContext;
import com.tdkj.action.BaseAction;
import com.tdkj.model.risevalue.BeanPlateQuotationCustom;
import com.tdkj.model.risevalue.BeanPlateQuotationSubscription;
import com.tdkj.model.user.BeanUser;
import com.tdkj.service.risevalue.IBeanPlateQuotationCustomService;
import com.tdkj.service.risevalue.IBeanPlateQuotationSubscriptionService;
import com.tdkj.util.PublicConfing;

public class PlateQuotationAction extends BaseAction {
	
	private Long customId ;

	private IBeanPlateQuotationCustomService plateQuotationCustomService;
	
	private IBeanPlateQuotationSubscriptionService plateQuotationCustomSubscriptionService;
	
	private List<BeanPlateQuotationCustom> customs;
	
	private List<BeanPlateQuotationSubscription> subscriptions;
	
	
	public String execute(){
		BeanUser user  = (BeanUser)ActionContext.getContext().getSession().get(PublicConfing.MEMBER_MEMBWE_OBJ_STRING_CONFIG);
		Long userId = user.getId();
		
		customs = plateQuotationCustomService.getAll();
		
		subscriptions = plateQuotationCustomSubscriptionService.getByUserId(userId);
		
		return "success";
	}
	
	public String subscription(){
		BeanUser user  = (BeanUser)ActionContext.getContext().getSession().get(PublicConfing.MEMBER_MEMBWE_OBJ_STRING_CONFIG);
		Long userId = user.getId();
		
		plateQuotationCustomSubscriptionService.createSubscription(userId, customId);
		
		return execute();
	}

	/**
	 * @return the customId
	 */
	public Long getCustomId() {
		return customId;
	}

	/**
	 * @param customId the customId to set
	 */
	public void setCustomId(Long customId) {
		this.customId = customId;
	}

	/**
	 * @return the customs
	 */
	public List<BeanPlateQuotationCustom> getCustoms() {
		return customs;
	}

	/**
	 * @param customs the customs to set
	 */
	public void setCustoms(List<BeanPlateQuotationCustom> customs) {
		this.customs = customs;
	}

	/**
	 * @return the subscriptions
	 */
	public List<BeanPlateQuotationSubscription> getSubscriptions() {
		return subscriptions;
	}

	/**
	 * @param subscriptions the subscriptions to set
	 */
	public void setSubscriptions(List<BeanPlateQuotationSubscription> subscriptions) {
		this.subscriptions = subscriptions;
	}

	@Resource
	public void setPlateQuotationCustomService(
			IBeanPlateQuotationCustomService plateQuotationCustomService) {
		this.plateQuotationCustomService = plateQuotationCustomService;
	}

	@Resource
	public void setPlateQuotationCustomSubscriptionService(
			IBeanPlateQuotationSubscriptionService plateQuotationCustomSubscriptionService) {
		this.plateQuotationCustomSubscriptionService = plateQuotationCustomSubscriptionService;
	}
	
	

}
